package org.finalministry.properties;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.finalministry.logger.Logger;
import org.finalministry.logger.LoggerFactory;

public abstract class PropertiesHolder {

	private static final Logger logger = LoggerFactory.getLogger(PropertiesHolder.class);

	private Properties properties;

	public PropertiesHolder(InputStream resourceAsStream) {

		this.initPropertiesForFile(resourceAsStream);
	}

	public void initPropertiesForFile(InputStream resourceAsStream) {

		properties = new Properties();

		try {
			properties.load(resourceAsStream);
		} catch (IOException e) {
			logger.error("error while loading properties file from classpath", e);
		}
	}

	public Properties getProperties() {

		return properties;
	}
}
